package com.xiu.travel.portal.client;

import com.xiu.travel.portal.OpenFeignConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Component
@FeignClient(name = "login", url = OpenFeignConfig.TEST_API_URL)
public interface LoginClient {

    /**
     * 获取令牌
     */
    @GetMapping("distribution/api/oauth/token?grant_type={grantType}&client_id={clientId}&client_secret={clientSecret}")
    String getAccessToken(@PathVariable("clientId") String clientId, @PathVariable("clientSecret") String clientSecret, @PathVariable("grantType") String grantType);

    /**
     * 刷新令牌
     */
    @GetMapping("distribution/api/oauth/token?grant_type=refresh_token&client_id={clientId}&client_secret={clientSecret}&refresh_token={token}")
    String refreshAccessToken(@PathVariable("clientId") String clientId, @PathVariable("clientSecret") String clientSecret, @PathVariable("token") String token);
}

